Skip to content
This repository has been archived by the owner on Aug 11, 2021. It is now read-only.

feat: support passing AbortSignal instances to the configured blockservice #267

Merged
merged 2 commits into from
Apr 23, 2020

Conversation

achingbrain
Copy link
Member

This is so the user can signal that they are no longer interested in the results of the operation and system components can stop trying to fulfil it.

@achingbrain achingbrain requested a review from vmx April 15, 2020 09:07
@achingbrain
Copy link
Member Author

Refs ipfs/js-ipfs#2884

This is so the user can signal that they are no longer interested
in the results of the operation and system components can stop
trying to fulfil it.
@achingbrain achingbrain force-pushed the feat/support-aborting-requests branch from 8ef58c4 to c9fe11c Compare April 15, 2020 09:49
@codecov
Copy link

codecov bot commented Apr 15, 2020

Codecov Report

Merging #267 into master will increase coverage by 3.28%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #267      +/-   ##
==========================================
+ Coverage   86.84%   90.13%   +3.28%     
==========================================
  Files           2        2              
  Lines         152      152              
==========================================
+ Hits          132      137       +5     
+ Misses         20       15       -5     
Impacted Files Coverage Δ
src/index.js 88.97% <100.00%> (+3.67%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ee554e7...6488b8a. Read the comment docs.

Copy link
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just one question (inline).

This one seems to need ipfs/js-ipfs-block-service#89 to be released before it should be merged.

@@ -335,7 +348,7 @@ class IPLDResolver {
if (treePaths.length === 0 && queue.length > 0) {
({ cid, basePath } = queue.shift())
const format = await this._getFormat(cid.codec)
block = await this.bs.get(cid)
block = await this.bs.get(cid, options)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to forward only the signal value and not all of the options object? This is really just a question.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a fair point, but the way we wrap modules inside modules, if we let the wrapping module be the gatekeeper of what gets passed on, it becomes tied to the API of that module more strongly.

This may cause problems down the line as we're potentially passing more arguments to the wrapped module than strictly necessary, but we trade off against flexibility in that case.

@vmx vmx force-pushed the feat/support-aborting-requests branch from c9fe11c to 5661753 Compare April 16, 2020 20:23
@vmx
Copy link
Member

vmx commented Apr 16, 2020

The test failure seems to be an actual one. I can reproduce it locally even with a 30s timeout. I did run it locally with:

npm run test -- --target=browser --timeout=30000 -- --browsers FirefoxHeadless

It doesn't happen all the time, but almost on every run I do.

@achingbrain can you please have a look?

Copy link
Member

@vmx vmx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking back my approval as tests fail.

@achingbrain achingbrain force-pushed the feat/support-aborting-requests branch from 5661753 to 6488b8a Compare April 23, 2020 15:56
@achingbrain
Copy link
Member Author

Looks better now. Did you force-push just to trigger a build? Cos you can do that from the Travis CI without changing public history..

@vmx
Copy link
Member

vmx commented Apr 23, 2020

I force-pushed because I did a rebase.

@vmx vmx merged commit 2881a5b into master Apr 23, 2020
@vmx vmx deleted the feat/support-aborting-requests branch April 23, 2020 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants